New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix null cfg bug. #3050
Fix null cfg bug. #3050
Conversation
@@ -77,6 +77,11 @@ public override void Initialize(AnalysisContext context) | |||
} | |||
|
|||
ControlFlowGraph cfg = operationBlockStartContext.OperationBlocks.GetControlFlowGraph(); | |||
if (cfg == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a unit test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like Test_NullCfg_NoDiagnostic
covers this.
Any performance concerns with GetControlFlowGraph()
off the top of your head?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh are we creating a CFG for every operation block? We should certainly avoid that. CFG should only be computed for methods where we know will be perfoming DFA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dotpaul Can we create a work item/PR to ensure we create CFG lazily at the point where we know we will be executing DFA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping @LLLXXXCCC could fix this instance in this PR. I think this is the only place where the CFG is can be created without attempting DFA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix a new PR.
No description provided.